package com.imwenwen.util;


import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.select.Elements;

import java.io.IOException;

/**
 * @Author Imwenwen
 * @Date 2020-12-17 22:06
 * @ClassName JsoupUtil
 **/
public class JsoupUtil {
    public static  Elements jsoupbyid(String url, String id) throws IOException {
        Document doc = Jsoup.connect(url).timeout(10000).get();
        Elements elements = doc.getElementsByAttributeValue("id",id);
        return elements;
    }
    public static  Elements jsoupbyclassname(String url, String classname) throws IOException {
        Document doc = Jsoup.connect(url).timeout(10000).get();
        Elements elements = doc.getElementsByAttributeValue("class",classname);
        return elements;
    }
}
